Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCC-4407 - EDD Form Prepopulate Patron Email #422

Merged
merged 7 commits into from
Dec 20, 2024

Conversation

dgcohen
Copy link
Contributor

@dgcohen dgcohen commented Dec 18, 2024

Ticket:

This PR does the following:

  • Fetches the patron's email in getServerSideProps and pre-populates the email field with it if available.

How has this been tested?

  • Added a unit test

Accessibility concerns or updates

  • NA

Checklist:

  • I updated the CHANGELOG with the appropriate information and JIRA ticket number (if applicable).
  • I have added relevant accessibility documentation for this pull request.
  • All new and existing tests passed.

Copy link

vercel bot commented Dec 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
research-catalog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 20, 2024 9:04pm

@dgcohen dgcohen changed the base branch from main to hold-pages December 18, 2024 21:18
Copy link
Member

@EdwinGuzman EdwinGuzman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well just a minor type comment

pages/hold/request/[id]/edd.tsx Outdated Show resolved Hide resolved
@@ -250,6 +253,10 @@ export async function getServerSideProps({ params, req, res }) {

const patronEligibilityStatus = await fetchPatronEligibility(patronId)

// fetch patron's email to pre-populate the edd form if available
const patronData = await getPatronData(patronId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fetching a lot of patron data, though it doesn't appear to be taking a very long time. I still think that instead of using getPatronData, which builds out a whole my account dataset including checkouts and holds and fines, maybe you can use the MyAccount model's getPatron

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't I still need to initialize a MyAccount data model to use the getPatron function?

Copy link
Contributor Author

@dgcohen dgcohen Dec 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We talked offline and I ended up using MyAccount's getPatron function instead of calling getPatronData() since this counterintuitively involves less data instantiation.

@dgcohen dgcohen merged commit 2d116fe into hold-pages Dec 20, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants